package com.gaofans.vertx.boot.web.statics;

import com.google.common.collect.Lists;
import io.vertx.ext.web.Http2PushMapping;
import io.vertx.ext.web.handler.StaticHandler;

import java.nio.charset.Charset;
import java.util.Collections;
import java.util.List;
import java.util.Set;

public class StaticHandlerProperties {

    private String path = "/static/*";
    private String webRoot = StaticHandler.DEFAULT_WEB_ROOT;
    private long maxAgeSeconds = StaticHandler.DEFAULT_MAX_AGE_SECONDS;
    private boolean directoryListing = StaticHandler.DEFAULT_DIRECTORY_LISTING;
    private String directoryTemplateResource = StaticHandler.DEFAULT_DIRECTORY_TEMPLATE;
    private boolean includeHidden = StaticHandler.DEFAULT_INCLUDE_HIDDEN;
    private boolean filesReadOnly = StaticHandler.DEFAULT_FILES_READ_ONLY;
    private String indexPage = StaticHandler.DEFAULT_INDEX_PAGE;
    private boolean rangeSupport = StaticHandler.DEFAULT_RANGE_SUPPORT;
    private boolean allowRootFileSystemAccess = StaticHandler.DEFAULT_ROOT_FILESYSTEM_ACCESS;
    private boolean sendVaryHeader = StaticHandler.DEFAULT_SEND_VARY_HEADER;
    private Set<String> compressedMediaTypes = Collections.emptySet();
    private Set<String> compressedFileSuffixes = Collections.emptySet();
    private boolean cacheEnabled = StaticHandler.DEFAULT_CACHING_ENABLED;
    private String defaultContentEncoding = Charset.defaultCharset().name();
    private boolean alwaysAsyncFs = StaticHandler.DEFAULT_ALWAYS_ASYNC_FS;
    private boolean enableFsTuning = StaticHandler.DEFAULT_ENABLE_FS_TUNING;
    private int maxCacheSize = StaticHandler.DEFAULT_MAX_CACHE_SIZE;
    private long cacheEntryTimeout = StaticHandler.DEFAULT_CACHE_ENTRY_TIMEOUT;
    private List<Http2PushMapping> http2PushMapping = Lists.newArrayList();
    private boolean fileReadOnly = StaticHandler.DEFAULT_FILES_READ_ONLY;
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getWebRoot() {
        return webRoot;
    }

    public void setWebRoot(String webRoot) {
        this.webRoot = webRoot;
    }

    public long getMaxAgeSeconds() {
        return maxAgeSeconds;
    }

    public void setMaxAgeSeconds(long maxAgeSeconds) {
        this.maxAgeSeconds = maxAgeSeconds;
    }

    public boolean isDirectoryListing() {
        return directoryListing;
    }

    public void setDirectoryListing(boolean directoryListing) {
        this.directoryListing = directoryListing;
    }

    public String getDirectoryTemplateResource() {
        return directoryTemplateResource;
    }

    public void setDirectoryTemplateResource(String directoryTemplateResource) {
        this.directoryTemplateResource = directoryTemplateResource;
    }

    public boolean isIncludeHidden() {
        return includeHidden;
    }

    public void setIncludeHidden(boolean includeHidden) {
        this.includeHidden = includeHidden;
    }

    public boolean isFilesReadOnly() {
        return filesReadOnly;
    }

    public void setFilesReadOnly(boolean filesReadOnly) {
        this.filesReadOnly = filesReadOnly;
    }

    public String getIndexPage() {
        return indexPage;
    }

    public void setIndexPage(String indexPage) {
        this.indexPage = indexPage;
    }

    public boolean isRangeSupport() {
        return rangeSupport;
    }

    public void setRangeSupport(boolean rangeSupport) {
        this.rangeSupport = rangeSupport;
    }

    public boolean isAllowRootFileSystemAccess() {
        return allowRootFileSystemAccess;
    }

    public void setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess) {
        this.allowRootFileSystemAccess = allowRootFileSystemAccess;
    }

    public boolean isSendVaryHeader() {
        return sendVaryHeader;
    }

    public void setSendVaryHeader(boolean sendVaryHeader) {
        this.sendVaryHeader = sendVaryHeader;
    }

    public Set<String> getCompressedMediaTypes() {
        return compressedMediaTypes;
    }

    public void setCompressedMediaTypes(Set<String> compressedMediaTypes) {
        this.compressedMediaTypes = compressedMediaTypes;
    }

    public Set<String> getCompressedFileSuffixes() {
        return compressedFileSuffixes;
    }

    public void setCompressedFileSuffixes(Set<String> compressedFileSuffixes) {
        this.compressedFileSuffixes = compressedFileSuffixes;
    }

    public boolean isCacheEnabled() {
        return cacheEnabled;
    }

    public void setCacheEnabled(boolean cacheEnabled) {
        this.cacheEnabled = cacheEnabled;
    }

    public String getDefaultContentEncoding() {
        return defaultContentEncoding;
    }

    public void setDefaultContentEncoding(String defaultContentEncoding) {
        this.defaultContentEncoding = defaultContentEncoding;
    }

    public boolean isAlwaysAsyncFs() {
        return alwaysAsyncFs;
    }

    public void setAlwaysAsyncFs(boolean alwaysAsyncFs) {
        this.alwaysAsyncFs = alwaysAsyncFs;
    }

    public boolean isEnableFsTuning() {
        return enableFsTuning;
    }

    public void setEnableFsTuning(boolean enableFsTuning) {
        this.enableFsTuning = enableFsTuning;
    }

    public int getMaxCacheSize() {
        return maxCacheSize;
    }

    public void setMaxCacheSize(int maxCacheSize) {
        this.maxCacheSize = maxCacheSize;
    }

    public long getCacheEntryTimeout() {
        return cacheEntryTimeout;
    }

    public void setCacheEntryTimeout(long cacheEntryTimeout) {
        this.cacheEntryTimeout = cacheEntryTimeout;
    }

    public List<Http2PushMapping> getHttp2PushMapping() {
        return http2PushMapping;
    }

    public void setHttp2PushMapping(List<Http2PushMapping> http2PushMapping) {
        this.http2PushMapping = http2PushMapping;
    }

    public boolean isFileReadOnly() {
        return fileReadOnly;
    }

    public void setFileReadOnly(boolean fileReadOnly) {
        this.fileReadOnly = fileReadOnly;
    }
}
